package android.java.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;

public class DatabaseUtil {
	Connection conn;
	String driverName="com.mysql.jdbc.Driver";
	String url="jdbc:mysql://localhost:3306/";
	String dbName="android";
	String user="root";
	String password="199410";
	public Connection getConn(){
		try {
			Class.forName(driverName);
			conn=DriverManager.getConnection(url+dbName,user,password);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return conn;
	}
	public void close(Connection conn,PreparedStatement ps,ResultSet rs){
		try {
			if (rs != null) {
				rs.close();
			}
			if(ps!=null){
				ps.close();
			}
			if(conn!=null){
				conn.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
